package com.hzwq.demo2.permission.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzwq.demo2.permission.entity.Permission;
import com.hzwq.demo2.permission.mapper.PermissionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhaochunlin
 * @since 2020-08-13
 */
@Service
public class PermissionServiceImpl extends ServiceImpl<PermissionMapper, Permission> implements IPermissionService {

    @Autowired
    PermissionMapper permissionMapper;

    @Override
    public boolean saveOrUpdate(Permission permission) {
        if (permission.getId() != null) {
            permission.setUpdateTime(new Date());
        } else {
            permission.setInsertTime(new Date());
        }
        return super.saveOrUpdate(permission);
    }

    @Override
    public void del(List<Integer> list) {
        permissionMapper.del(list);
    }

}
